package com.cloudsigns.factorymanager2.engineering.presenter;

import com.cloudsigns.factorymanager2.engineering.IView.IPublicationFeedBackSureView;
import com.cloudsigns.factorymanager2.engineering.model.IPublicationFeedBackSureModel;
import com.cloudsigns.factorymanager2.engineering.model.PublicationFeedBackSureModel;

/**
 * Created by tony on 2018/6/17.
 */

public class PublicationFeedBackSurePresenter {

    private IPublicationFeedBackSureView view;
    private IPublicationFeedBackSureModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public PublicationFeedBackSurePresenter(IPublicationFeedBackSureView view) {
        this.view = view;
        this.model = new PublicationFeedBackSureModel();
    }

    public void publicationFeedBackSure() {


        model.publicationFeedBackSure(view.getOrderId(),view.getitemId(), new  PublicationFeedBackSureModel.OnPublicationFeedBackSureListener() {
            @Override
            public void publicationFeedBackSureSuccessed() {
                //需要在UI线程执行
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.publicationFeedBackSureSuccessed();
                        view.hideLoading();
                    }
                });
            }

            @Override
            public void publicationFeedBackSureFailed(final String desc) {
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        view.publicationFeedBackSureFailed(desc);
                        view.hideLoading();
                    }
                });
            }


        });
    }
}
